Learn R Programming

RDS (version 0.9-9)

[.rds.data.frame: indexing

Description

indexing

Usage

# S3 method for rds.data.frame
[(x, i, j, ..., drop, warn = TRUE)

Arguments

x

object

i

indices

j

indices

...

unused

drop

drop

warn

Warn if any new seeds are created

Details

Subsetting of RDS recruitment trees does not always yield a full RDS tree. In this case, subjects whose recruiter is no longer in the dataset are considered seeds. is issued if the 'warn' parameter is TRUE. dat <- data.frame(id=c(1,2,3,4,5), recruiter.id=c(2,-1,2,-1,4), network.size.variable=c(4,8,8,2,3)) r <- as.rds.data.frame(dat) r[1:3,] # A valid pruning of the RDS tree. r[c(1,5),warn=FALSE] # recruiter.id of last row set to -1 (i.e. a seed) to maintain validity of tree